package com.net.oil.main;

import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.net.oil.R;
import com.net.oil.app.Constant;
import com.net.oil.http.AppUrl;
import com.net.oil.util.AppInfo;
import com.net.oil.webview.WebViewActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class AboutUsActivity extends AppCompatActivity {

    @BindView(R.id.toolbar_go_back)
    ImageView toolbarGoBack;
    @BindView(R.id.toolbar_title)
    TextView toolbarTitle;
    @BindView(R.id.user_agreement_tv)
    TextView userAgreementTv;
    @BindView(R.id.official_website_tv)
    TextView officialWebsiteTv;
    @BindView(R.id.version_tv)
    TextView versionTv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about_us);
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        toolbarTitle.setText("关于我们");

        versionTv.setText(AppInfo.getVersionName());
    }

    @OnClick({R.id.toolbar_go_back, R.id.user_agreement_tv, R.id.official_website_tv})
    public void onViewClicked(View view) {
        Intent intent = new Intent();
        switch (view.getId()) {
            case R.id.toolbar_go_back:
                finish();
                break;
            case R.id.user_agreement_tv:
                intent.setClass(this, WebViewActivity.class);
                intent.putExtra(Constant.INTENT_TO_WEBVIEW_URL_KEY, AppUrl.ABOUS_US);
                intent.putExtra(Constant.INTENT_IS_SHARE, false);
                startActivity(intent);
                break;
            case R.id.official_website_tv:
                intent.setClass(this, WebViewActivity.class);
                intent.putExtra(Constant.INTENT_TO_WEBVIEW_URL_KEY, AppUrl.UCCN);
                intent.putExtra(Constant.INTENT_IS_SHARE, false);
                startActivity(intent);
                break;
        }
    }
}
